﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Infrastructure.Logging
{
    public class LogFormater
    {
        public static string FormatException(Exception e)
        {
            if (e == null) return string.Empty;
            StringBuilder builder = new StringBuilder();
            GetExceptionListInfo(e, ref builder);
            return builder.ToString();
        }

        private static void GetExceptionListInfo(Exception e, ref StringBuilder infoStorage)
        {
            infoStorage.Append(e.Message);
            infoStorage.AppendLine();
            if (e.InnerException != null)
            {
                GetExceptionListInfo(e.InnerException, ref infoStorage);
            }
            infoStorage.AppendLine(e.StackTrace);
            infoStorage.AppendLine();
        }

        internal static string Format(log4net.Core.LoggingEvent loggingEvent, bool ignoresException)
        {
            throw new NotImplementedException();
        }
    }
}
